Repository navigation
feat(manifest): ask for the reachability settings in the setup wizards - #1729
Jeppe Fredsgaard Blaabjerg (jfblaa) wants to merge 4 commits into
Conversation
08f14b1 to
bc39c00
Compare
bc39c00 to
78fadc7
Compare
PR SummaryLow Risk Overview The wizards ask whether to compile before reachability ( Invalid or tool-incompatible Changelog and broad unit/integration tests cover inheritance, overrides, validation, and write behavior. Reviewed by Cursor Bugbot for commit 78fadc7. Configure here. |
78fadc7 to
14db272
Compare
14db272 to
8e07fbd
Compare
8e07fbd to
f245568
Compare
f245568 to
d957ff9
Compare
244ddca to
283e6d4
Compare
283e6d4 to
88d51b6
Compare
524d8d5 to
bda599d
Compare
bda599d to
4c30549
Compare
4c30549 to
a596c09
Compare
Martin Torp (mtorp)
left a comment
There was a problem hiding this comment.
Two wizard choices can change which settings a scan actually uses. The inline comments trace both cases and include the source-comment notes.
| name: 'no', | ||
| value: false, | ||
| description: effective | ||
| ? `Keep ${effective} ${prompts.keep}${Object.hasOwn(reachability, field) ? '' : ', as a parent socket.json sets it'}` |
There was a problem hiding this comment.
POLA-02 This choice promises to keep the parent’s JDK. Choosing No writes no local override, but socket scan create --reach --auto-manifest reads only the current directory’s socket.json. Running it from the child can silently select a different JDK. The same goes for an inherited .NET runtime.
Could the wizard and auto-manifest use the same lookup for reachability settings, including an explicit child clear? A test can choose No in a child with a parent JDK and check which JDK the scan sends to Coana. Auto-manifest lookup
| // eslint-disable-next-line no-await-in-loop | ||
| const result = await runEcosystemWizard(ecosystem, section) | ||
| const result = await runEcosystemWizard(ecosystem, section, { | ||
| inheritedReachability: inherited['reachability'], |
There was a problem hiding this comment.
POLA-04 In a directory with only nested Maven projects, accepting an inherited compile at every prompt writes compile into this directory’s own socket.json. Accepting a prefilled JDK or runtime can do the same. When the parent later changes, this subtree stays on the old value.
Could we use the field comparison already used for individual builds when staging these directory defaults? That would preserve existing explicit local choices and let untouched inherited values keep following the parent. Existing comparison
| inheritedReachability?: unknown | ||
| } | ||
|
|
||
| // As written, so that the wizard can replace an invalid value. |
There was a problem hiding this comment.
CMT-33 I read this as saying the wizard can repair an invalid value in the parent file. It edits the current directory’s file and filters invalid inherited values out of the prompt defaults. Could the comment make that scope explicit?
| // The fields of `value` that `tool`'s builds take, warning about the rest the | ||
| // answers replace; an inherited invalid value is its own socket.json's to fix. |
There was a problem hiding this comment.
CMT-34 Wording nit. Could we give local and inherited settings their own sentences?
| // The fields of `value` that `tool`'s builds take, warning about the rest the | |
| // answers replace; an inherited invalid value is its own socket.json's to fix. | |
| // The wizard warns about invalid local values and replaces them with the answers. | |
| // Invalid inherited values need to be fixed in the socket.json that sets them. |
| // A "no" to a value's question keeps the value in effect; "none" is written | ||
| // only to override an inherited "compile". |
There was a problem hiding this comment.
CMT-35 Wording nit. Could we separate the two wizard choices?
| // A "no" to a value's question keeps the value in effect; "none" is written | |
| // only to override an inherited "compile". | |
| // Answering no to a value prompt keeps the effective value. | |
| // The wizard writes "none" to override an inherited "compile". |
| // Answers the reachability question with `wantsJavaHome` and its JDK prompt | ||
| // with `javaHome`; every other prompt keeps its default. |
There was a problem hiding this comment.
CMT-36 Wording nit. Could we put the unrelated prompt defaults in a second sentence?
| // Answers the reachability question with `wantsJavaHome` and its JDK prompt | |
| // with `javaHome`; every other prompt keeps its default. | |
| // Answers the JDK choice with `wantsJavaHome` and the path prompt with `javaHome`. | |
| // Other prompts keep their defaults. |
| // Answers the build question with `wantsBuild`; every other prompt keeps | ||
| // its default. Returns the build question's shown default per call. |
There was a problem hiding this comment.
CMT-37 Wording nit. Could we give the recorded default its own sentence?
| // Answers the build question with `wantsBuild`; every other prompt keeps | |
| // its default. Returns the build question's shown default per call. | |
| // Answers the build prompt with `wantsBuild` and accepts the other defaults. | |
| // Returns the build prompt’s displayed default for each call. |
| // Answers the runtime question with `wantsRuntime` and its prompt with | ||
| // `runtimeVersion`; records each runtime prompt. |
There was a problem hiding this comment.
CMT-38 Wording nit. Could we separate the answers from what the helper records?
| // Answers the runtime question with `wantsRuntime` and its prompt with | |
| // `runtimeVersion`; records each runtime prompt. | |
| // Answers the runtime choice with `wantsRuntime` and the version prompt with `runtimeVersion`. | |
| // Records each runtime prompt. |
| if (applyAnswer(reachability as Record<string, string>, field, answer)) { | ||
| return canceledByUser() | ||
| } | ||
| // A blank answer must also clear an inherited value, not fall back to it. |
There was a problem hiding this comment.
CMT-39 Wording nit. Could we state the effect of a blank answer directly?
| // A blank answer must also clear an inherited value, not fall back to it. | |
| // A blank answer writes null to clear an inherited value. |
`socket manifest setup` and `socket manifest setup --dynamic-sbom-inference` ask, for each build tool that generates facts: - whether to build the project before reachability analysis. A no writes "none" only to override an inherited "compile", and otherwise leaves the setting unset; - Maven, Gradle and sbt: whether to use a different JDK for the analysis, showing the one in effect, inherited or not; - .NET: whether to start a framework-dependent build's analysis on a given runtime, taking major.minor or major.minor.patch[-prerelease]. The wizards read socket.json as written, so they run under an invalid reachability value: they warn about what a build tool cannot take and replace it with the answers, and ignore an invalid inherited value for their defaults.
`socket manifest setup --dynamic-sbom-inference` wrote every accepted default of a directory's section into its socket.json, so accepting an inherited reachability value pinned it there. It now keeps only the fields that differ from what the directory inherits, as it does for a build.
Answering no to a different JDK in a directory under a socket.json that sets one writes nothing, and the scan there reads the parent's JDK; answering yes with a blank JDK writes null, and the scan reads none.
a596c09 to
02ccecc
Compare
Heads up, reviewer
Update wizard to configure reachability settings 🧙♂️
LLM Description written by Claude Code:claude-opus-5-5
socket manifest setupandsocket manifest setup --dynamic-sbom-inferenceask for #1728'sreachabilitysettings for each build tool that generates Socket facts, so they can be set without editing socket.json by hand.Merges with the stack. The Coana release it needs is pinned on v1.x since #1762.
Questions
"none"only to override an inherited"compile".reachabilityvalue is invalid: they warn about one in the socket.json they write and replace it with the answers.Stack
Changelog
In
CHANGELOG.mdunder[Unreleased]:Added
socket manifest setupandsocket manifest setup --dynamic-sbom-inferenceask for the reachability settings, so there is no need to editsocket.jsonby hand.🤖 Generated with Claude Code